package com.candy.common.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 通用表单 Mapper 接口
 * </p>
 *
 * @author pxs
 * @since 2021-12-13
 */
public interface CommonMapper
{
    /**
     * 加载
     * @param id
     * @param tableName
     * @return java.lang.Integer
     */
    HashMap<String,Object> getMapById(@Param("id") Serializable id, @Param("propertyAndColumnMap") HashMap<String, String> propertyAndColumnMap, @Param("tableName") String tableName);

    /**
     * 列表查询
     * @param paramMap
     * @param propertyAndColumnMap
     * @param tableName
     * @return
     */
    List<HashMap<String,Object>> getMapList(@Param("paramMap") HashMap<String, Object> paramMap, @Param("propertyAndColumnMap") HashMap<String, String> propertyAndColumnMap, @Param("tableName") String tableName);

    Page<Map<String, Object>> getMapsPage(@Param("page")Page<?> page, @Param("paramMap") HashMap<String, Object> paramMap, @Param("propertyAndColumnMap") HashMap<String, String> propertyAndColumnMap, @Param("tableName") String tableName);

    /**
     * 保存
     * @param paramMap
     * @param tableName
     * @return java.lang.Integer
     */
    Integer saveMap(@Param("paramMap") HashMap<String, Object> paramMap, @Param("tableName") String tableName);

    /**
     * 更新
     * @param paramMap
     * @param tableName
     * @return
     */
    Integer updateMapById(@Param("paramMap") HashMap<String, Object> paramMap, @Param("tableName") String tableName);
}
